<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Aria: ArMutex Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Aria
   &#160;<span id="projectnumber">2.9.4</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li><a href="examples.html"><span>Examples</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('classArMutex.html','');});
</script>
<div id="doc-content">
<div class="header">
  <div class="summary">
<a href="#pub-types">Public Types</a> &#124;
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pub-static-methods">Static Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="#pro-attribs">Protected Attributes</a> &#124;
<a href="#pro-static-attribs">Static Protected Attributes</a> &#124;
<a href="classArMutex-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">ArMutex Class Reference<div class="ingroups"><a class="el" href="group__UtilityClasses.html">Utility Classes</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>Cross-platform mutex wrapper class.  
 <a href="classArMutex.html#details">More...</a></p>

<p><code>#include &lt;ArMutex.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-types"></a>
Public Types</h2></td></tr>
<tr class="memitem:ae40660428bf6083d5d3ce14f98ace19f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae40660428bf6083d5d3ce14f98ace19f"></a>
typedef pthread_mutex_t&#160;</td><td class="memItemRight" valign="bottom"><b>MutexType</b></td></tr>
<tr class="separator:ae40660428bf6083d5d3ce14f98ace19f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a5b6ab50205f1004c939f3946cfca3c62"><td class="memItemLeft" align="right" valign="top">enum &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62">Status</a> { <a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a410e62490f5c6ca8e320d60d1a25081b">STATUS_FAILED_INIT</a> =1, 
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62afef90eab73ec7c605c7d2093572db8ad">STATUS_FAILED</a>, 
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a5a52964b5d55e36a0d170a49a8384961">STATUS_ALREADY_LOCKED</a>
 }</td></tr>
<tr class="separator:a5b6ab50205f1004c939f3946cfca3c62"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a69c6e7a984d23363faabf5969a0aa51b"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a69c6e7a984d23363faabf5969a0aa51b">ArMutex</a> (bool recursive=true)</td></tr>
<tr class="memdesc:a69c6e7a984d23363faabf5969a0aa51b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Constructor.  <a href="#a69c6e7a984d23363faabf5969a0aa51b">More...</a><br /></td></tr>
<tr class="separator:a69c6e7a984d23363faabf5969a0aa51b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3eb0fbf29060b36c2c61d590104fa8f3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3eb0fbf29060b36c2c61d590104fa8f3"></a>
&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a3eb0fbf29060b36c2c61d590104fa8f3">ArMutex</a> (const <a class="el" href="classArMutex.html">ArMutex</a> &amp;mutex)</td></tr>
<tr class="memdesc:a3eb0fbf29060b36c2c61d590104fa8f3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Copy constructor. <br /></td></tr>
<tr class="separator:a3eb0fbf29060b36c2c61d590104fa8f3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab6c0c5262a57b1cad42da3ed161dcd74"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ab6c0c5262a57b1cad42da3ed161dcd74"></a>
virtual const char *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#ab6c0c5262a57b1cad42da3ed161dcd74">getError</a> (int messageNumber) const </td></tr>
<tr class="memdesc:ab6c0c5262a57b1cad42da3ed161dcd74"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a human readable error message from an error code. <br /></td></tr>
<tr class="separator:ab6c0c5262a57b1cad42da3ed161dcd74"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a906a64080c402fc53e6502d4163ed34d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a906a64080c402fc53e6502d4163ed34d"></a>
virtual MutexType &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a906a64080c402fc53e6502d4163ed34d">getMutex</a> ()</td></tr>
<tr class="memdesc:a906a64080c402fc53e6502d4163ed34d"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get a reference to the underlying OS-specific mutex variable. <br /></td></tr>
<tr class="separator:a906a64080c402fc53e6502d4163ed34d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b6aee74872c19fb8829d96dc3e52f34"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a7b6aee74872c19fb8829d96dc3e52f34">lock</a> ()</td></tr>
<tr class="memdesc:a7b6aee74872c19fb8829d96dc3e52f34"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lock the mutex.  <a href="#a7b6aee74872c19fb8829d96dc3e52f34">More...</a><br /></td></tr>
<tr class="separator:a7b6aee74872c19fb8829d96dc3e52f34"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a98c8e884ea991c9eead1359ac4c915bb"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a98c8e884ea991c9eead1359ac4c915bb">setLog</a> (bool log)</td></tr>
<tr class="memdesc:a98c8e884ea991c9eead1359ac4c915bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a flag that will log out when we lock and unlock.  <a href="#a98c8e884ea991c9eead1359ac4c915bb">More...</a><br /></td></tr>
<tr class="separator:a98c8e884ea991c9eead1359ac4c915bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a00069ede1325b6f9f500ef2636858262"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a00069ede1325b6f9f500ef2636858262"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a00069ede1325b6f9f500ef2636858262">setLogName</a> (const char *logName)</td></tr>
<tr class="memdesc:a00069ede1325b6f9f500ef2636858262"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a name we'll use to log with. <br /></td></tr>
<tr class="separator:a00069ede1325b6f9f500ef2636858262"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7211feb3bf6a740a857ca6e338229f1b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a7211feb3bf6a740a857ca6e338229f1b">setLogNameVar</a> (const char *logName,...)</td></tr>
<tr class="memdesc:a7211feb3bf6a740a857ca6e338229f1b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a name we'll use to log with formatting.  <a href="#a7211feb3bf6a740a857ca6e338229f1b">More...</a><br /></td></tr>
<tr class="separator:a7211feb3bf6a740a857ca6e338229f1b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a76ff7a4aa451cc9c2b08dda0ae77d823"><td class="memItemLeft" align="right" valign="top">virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a76ff7a4aa451cc9c2b08dda0ae77d823">tryLock</a> ()</td></tr>
<tr class="memdesc:a76ff7a4aa451cc9c2b08dda0ae77d823"><td class="mdescLeft">&#160;</td><td class="mdescRight">Try to lock the mutex, but do not block.  <a href="#a76ff7a4aa451cc9c2b08dda0ae77d823">More...</a><br /></td></tr>
<tr class="separator:a76ff7a4aa451cc9c2b08dda0ae77d823"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afb51b5514a9456f23441e479fe58fb46"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afb51b5514a9456f23441e479fe58fb46"></a>
virtual int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#afb51b5514a9456f23441e479fe58fb46">unlock</a> ()</td></tr>
<tr class="memdesc:afb51b5514a9456f23441e479fe58fb46"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unlock the mutex, allowing another thread to obtain the lock. <br /></td></tr>
<tr class="separator:afb51b5514a9456f23441e479fe58fb46"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0993ae31527043d9c9c7fa75b6529080"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0993ae31527043d9c9c7fa75b6529080"></a>
virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a0993ae31527043d9c9c7fa75b6529080">~ArMutex</a> ()</td></tr>
<tr class="memdesc:a0993ae31527043d9c9c7fa75b6529080"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destructor. <br /></td></tr>
<tr class="separator:a0993ae31527043d9c9c7fa75b6529080"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-static-methods"></a>
Static Public Member Functions</h2></td></tr>
<tr class="memitem:a427415d8a47d36abee174f8504c2ce67"><td class="memItemLeft" align="right" valign="top">static double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a427415d8a47d36abee174f8504c2ce67">getLockWarningTime</a> (void)</td></tr>
<tr class="memdesc:a427415d8a47d36abee174f8504c2ce67"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the lock warning time (sec)  <a href="#a427415d8a47d36abee174f8504c2ce67">More...</a><br /></td></tr>
<tr class="separator:a427415d8a47d36abee174f8504c2ce67"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a97bab3f08a097cc206169deec0a96bb7"><td class="memItemLeft" align="right" valign="top">static double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#a97bab3f08a097cc206169deec0a96bb7">getUnlockWarningTime</a> (void)</td></tr>
<tr class="memdesc:a97bab3f08a097cc206169deec0a96bb7"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the lock warning time (sec)  <a href="#a97bab3f08a097cc206169deec0a96bb7">More...</a><br /></td></tr>
<tr class="separator:a97bab3f08a097cc206169deec0a96bb7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad0df3cd5e0d03c21975d0380585596d1"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#ad0df3cd5e0d03c21975d0380585596d1">setLockWarningTime</a> (double lockWarningSeconds)</td></tr>
<tr class="memdesc:ad0df3cd5e0d03c21975d0380585596d1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the lock warning time (sec).  <a href="#ad0df3cd5e0d03c21975d0380585596d1">More...</a><br /></td></tr>
<tr class="separator:ad0df3cd5e0d03c21975d0380585596d1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af9459634b10d103c933e058ce73f6874"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classArMutex.html#af9459634b10d103c933e058ce73f6874">setUnlockWarningTime</a> (double unlockWarningSeconds)</td></tr>
<tr class="memdesc:af9459634b10d103c933e058ce73f6874"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the unlock warning time (sec).  <a href="#af9459634b10d103c933e058ce73f6874">More...</a><br /></td></tr>
<tr class="separator:af9459634b10d103c933e058ce73f6874"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a7b4e4f99b02e169107354f5ec74c74d6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a7b4e4f99b02e169107354f5ec74c74d6"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>checkLockTime</b> ()</td></tr>
<tr class="separator:a7b4e4f99b02e169107354f5ec74c74d6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aba49b52a95bac12a5b74d9f25aa5eb25"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aba49b52a95bac12a5b74d9f25aa5eb25"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>checkUnlockTime</b> ()</td></tr>
<tr class="separator:aba49b52a95bac12a5b74d9f25aa5eb25"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adc6f5f9b70c0a1a8d3e9ff99c5650acf"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="adc6f5f9b70c0a1a8d3e9ff99c5650acf"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>initLockTiming</b> ()</td></tr>
<tr class="separator:adc6f5f9b70c0a1a8d3e9ff99c5650acf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0f0713b692e16640f72aa73ad6545798"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0f0713b692e16640f72aa73ad6545798"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>startLockTimer</b> ()</td></tr>
<tr class="separator:a0f0713b692e16640f72aa73ad6545798"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad69f7cc40e8eb3e6dca058a06e57e25e"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ad69f7cc40e8eb3e6dca058a06e57e25e"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>startUnlockTimer</b> ()</td></tr>
<tr class="separator:ad69f7cc40e8eb3e6dca058a06e57e25e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa08770fd9af5bb7a6e1ba2fc6e08dfdd"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa08770fd9af5bb7a6e1ba2fc6e08dfdd"></a>
void&#160;</td><td class="memItemRight" valign="bottom"><b>uninitLockTiming</b> ()</td></tr>
<tr class="separator:aa08770fd9af5bb7a6e1ba2fc6e08dfdd"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-attribs"></a>
Protected Attributes</h2></td></tr>
<tr class="memitem:a4513a9aae549fff57b227d2ea42cd920"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4513a9aae549fff57b227d2ea42cd920"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myFailedInit</b></td></tr>
<tr class="separator:a4513a9aae549fff57b227d2ea42cd920"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a94a2fd0cd020161f9c1c62449289b141"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a94a2fd0cd020161f9c1c62449289b141"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myFirstLock</b></td></tr>
<tr class="separator:a94a2fd0cd020161f9c1c62449289b141"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aca8dee050be7038b899e4a7ea5c497da"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aca8dee050be7038b899e4a7ea5c497da"></a>
<a class="el" href="classArTime.html">ArTime</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>myLockStarted</b></td></tr>
<tr class="separator:aca8dee050be7038b899e4a7ea5c497da"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a62514f78e031d12e79f63006a8e4ba95"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a62514f78e031d12e79f63006a8e4ba95"></a>
<a class="el" href="classArTime.html">ArTime</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>myLockTime</b></td></tr>
<tr class="separator:a62514f78e031d12e79f63006a8e4ba95"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f6dbd48727b3b6966321e64f50506fb"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4f6dbd48727b3b6966321e64f50506fb"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myLog</b></td></tr>
<tr class="separator:a4f6dbd48727b3b6966321e64f50506fb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a69c25005aec0d6381f834ac89de6214a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a69c25005aec0d6381f834ac89de6214a"></a>
std::string&#160;</td><td class="memItemRight" valign="bottom"><b>myLogName</b></td></tr>
<tr class="separator:a69c25005aec0d6381f834ac89de6214a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a296fc1e8215c6e615c94f5334dbf7a97"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a296fc1e8215c6e615c94f5334dbf7a97"></a>
MutexType&#160;</td><td class="memItemRight" valign="bottom"><b>myMutex</b></td></tr>
<tr class="separator:a296fc1e8215c6e615c94f5334dbf7a97"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a14e99258a1f5c1f4ab1b3f1f2c7d38a1"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a14e99258a1f5c1f4ab1b3f1f2c7d38a1"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myNonRecursive</b></td></tr>
<tr class="separator:a14e99258a1f5c1f4ab1b3f1f2c7d38a1"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:af5f771810efd04ed19b5381007e36ba6"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="af5f771810efd04ed19b5381007e36ba6"></a>
ArStrMap&#160;</td><td class="memItemRight" valign="bottom"><b>myStrMap</b></td></tr>
<tr class="separator:af5f771810efd04ed19b5381007e36ba6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae18273df7fa36a03cebf1580a0c50061"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae18273df7fa36a03cebf1580a0c50061"></a>
bool&#160;</td><td class="memItemRight" valign="bottom"><b>myWasAlreadyLocked</b></td></tr>
<tr class="separator:ae18273df7fa36a03cebf1580a0c50061"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-static-attribs"></a>
Static Protected Attributes</h2></td></tr>
<tr class="memitem:afd2321c3c11ef25bccd95b9b08e1d3e7"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="afd2321c3c11ef25bccd95b9b08e1d3e7"></a>
static unsigned int&#160;</td><td class="memItemRight" valign="bottom"><b>ourLockWarningMS</b> = 0</td></tr>
<tr class="separator:afd2321c3c11ef25bccd95b9b08e1d3e7"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1ca63d6be4f8f9d7cfb4e9c44d4c1b8f"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a1ca63d6be4f8f9d7cfb4e9c44d4c1b8f"></a>
static <a class="el" href="classArFunctor.html">ArFunctor</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>ourNonRecursiveDeadlockFunctor</b> = NULL</td></tr>
<tr class="separator:a1ca63d6be4f8f9d7cfb4e9c44d4c1b8f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a15ce3854c36d1e8ec46dfc95f8d3703c"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a15ce3854c36d1e8ec46dfc95f8d3703c"></a>
static unsigned int&#160;</td><td class="memItemRight" valign="bottom"><b>ourUnlockWarningMS</b> = 0</td></tr>
<tr class="separator:a15ce3854c36d1e8ec46dfc95f8d3703c"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Cross-platform mutex wrapper class. </p>
<p>This class wraps the operating system's mutex functions. It allows mutualy exclusive access to a critical section. This is extremely useful for multiple threads which want to use the same variable. On Linux, <a class="el" href="classArMutex.html" title="Cross-platform mutex wrapper class. ">ArMutex</a> simply uses the POSIX pthread interface in an object oriented manner. It also applies the same concept to Windows using Windows' own abilities to restrict access to critical sections. <a class="el" href="classArMutex.html" title="Cross-platform mutex wrapper class. ">ArMutex</a> also adds additional diagnostic/debugging tools such as logging and timing.</p>
<dl class="section note"><dt>Note</dt><dd><a class="el" href="classArMutex.html" title="Cross-platform mutex wrapper class. ">ArMutex</a> is by default a recursive mutex. This means that a thread is allowed to acquire an additional lock (whether via <a class="el" href="classArMutex.html#a7b6aee74872c19fb8829d96dc3e52f34" title="Lock the mutex. ">lock()</a> or <a class="el" href="classArMutex.html#a76ff7a4aa451cc9c2b08dda0ae77d823" title="Try to lock the mutex, but do not block. ">tryLock()</a>) on a locked mutex if that same thread already has the lock. This allows a thread to lock a mutex, but not become deadlocked if any functions called while it is locked also attempt to lock the mutex, while still preventing other threads from interrupting it. If you want a non-recursive mutex, so that multiple attempts by the same thread to lock a mutex to block, supply an argument of 'false' to the constructor.</dd></dl>
<p>In addition to provding cross-platform API to OS mutex objects, <a class="el" href="classArMutex.html" title="Cross-platform mutex wrapper class. ">ArMutex</a> adds some diagnostic features: </p><ul>
<li>
Use <a class="el" href="classArMutex.html#ad0df3cd5e0d03c21975d0380585596d1" title="Sets the lock warning time (sec). ">setLockWarningTime()</a> to warn if a call to <a class="el" href="classArMutex.html#a7b6aee74872c19fb8829d96dc3e52f34" title="Lock the mutex. ">lock()</a> takes more than the given amount of time. This can help find potential performance impacts and other undesired effects of lock contention. </li>
<li>
Use <a class="el" href="classArMutex.html#af9459634b10d103c933e058ce73f6874" title="Sets the unlock warning time (sec). ">setUnlockWarningTime()</a> to warn if the time elapsed between <a class="el" href="classArMutex.html#a7b6aee74872c19fb8829d96dc3e52f34" title="Lock the mutex. ">lock()</a> and <a class="el" href="classArMutex.html#afb51b5514a9456f23441e479fe58fb46" title="Unlock the mutex, allowing another thread to obtain the lock. ">unlock()</a> is more than a given amount of time. This can help find potential performance impacts and other undesired effects of code holding a lock for a long time. </li>
<li>
Use <a class="el" href="classArMutex.html#a00069ede1325b6f9f500ef2636858262" title="Sets a name we&#39;ll use to log with. ">setLogName()</a> to name an <a class="el" href="classArMutex.html" title="Cross-platform mutex wrapper class. ">ArMutex</a> object for logging. </li>
<li>
Use <a class="el" href="classArMutex.html#a98c8e884ea991c9eead1359ac4c915bb" title="Sets a flag that will log out when we lock and unlock. ">setLog()</a> to enable logging of various events such as lock, unlock, errors. </li>
</ul>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="gpsRobotTaskExample_8cpp-example.html#_a5">gpsRobotTaskExample.cpp</a>, and <a class="el" href="threadExample_8cpp-example.html#_a2">threadExample.cpp</a>.</dd>
</dl></div><h2 class="groupheader">Member Enumeration Documentation</h2>
<a class="anchor" id="a5b6ab50205f1004c939f3946cfca3c62"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">enum <a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62">ArMutex::Status</a></td>
        </tr>
      </table>
</div><div class="memdoc">
<table class="fieldtable">
<tr><th colspan="2">Enumerator</th></tr><tr><td class="fieldname"><a class="anchor" id="a5b6ab50205f1004c939f3946cfca3c62a410e62490f5c6ca8e320d60d1a25081b"></a>STATUS_FAILED_INIT&#160;</td><td class="fielddoc">
<p>Failed to initialize. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="a5b6ab50205f1004c939f3946cfca3c62afef90eab73ec7c605c7d2093572db8ad"></a>STATUS_FAILED&#160;</td><td class="fielddoc">
<p>General failure. </p>
</td></tr>
<tr><td class="fieldname"><a class="anchor" id="a5b6ab50205f1004c939f3946cfca3c62a5a52964b5d55e36a0d170a49a8384961"></a>STATUS_ALREADY_LOCKED&#160;</td><td class="fielddoc">
<p>Mutex already locked. </p>
</td></tr>
</table>

</div>
</div>
<h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a69c6e7a984d23363faabf5969a0aa51b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">ArMutex::ArMutex </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>recursive</em> = <code>true</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Constructor. </p>
<p>KMC TESTING myStrMap[STATUS_FAILED_INIT]="Failed to initialize"; myStrMap[STATUS_FAILED]="General failure"; myStrMap[STATUS_ALREADY_LOCKED]="Mutex already locked";</p>

</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="a427415d8a47d36abee174f8504c2ce67"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static double ArMutex::getLockWarningTime </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the lock warning time (sec) </p>
<dl class="section note"><dt>Note</dt><dd>Available on Linux only </dd></dl>

</div>
</div>
<a class="anchor" id="a97bab3f08a097cc206169deec0a96bb7"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static double ArMutex::getUnlockWarningTime </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Gets the lock warning time (sec) </p>
<dl class="section note"><dt>Note</dt><dd>Available on Linux only </dd></dl>

</div>
</div>
<a class="anchor" id="a7b6aee74872c19fb8829d96dc3e52f34"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int ArMutex::lock </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Lock the mutex. </p>
<p>If this is a recursive mutex (the default type), and a <em>different</em> thread has locked this mutex, then block until it is unlocked; if <em>this</em> thread has locked this mutex, then continue immediately and do not block.</p>
<p>If this is <em>not</em> a recursive mutex, then block if any thread (including this thread) has locked this mutex.</p>
<p>Call setLog(true) to enable extra logging.</p>
<dl class="section return"><dt>Returns</dt><dd>0 if the mutex was successfully locked (after blocking if it was already locked by another thread, or by any thread if this is <em>not</em> a recursive mutex). </dd>
<dd>
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a5a52964b5d55e36a0d170a49a8384961" title="Mutex already locked. ">ArMutex::STATUS_ALREADY_LOCKED</a> immediately if this is a recursive mutex (default) and the current thread has already locked this mutex. </dd>
<dd>
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62afef90eab73ec7c605c7d2093572db8ad" title="General failure. ">ArMutex::STATUS_FAILED</a> on an error from the platform mutex implementation. </dd>
<dd>
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a410e62490f5c6ca8e320d60d1a25081b" title="Failed to initialize. ">ArMutex::STATUS_FAILED_INIT</a> if the platform threading is not enabled, initialized, etc.</dd></dl>
<p>This function will block until no other thread has this mutex locked. If it returns 0, then it obtained the lock and the thread is free to use the critical section that this mutex protects. Else it returns an error code. See <a class="el" href="classArMutex.html#ab6c0c5262a57b1cad42da3ed161dcd74" title="Get a human readable error message from an error code. ">getError()</a>. </p>
<dl><dt><b>Examples: </b></dt><dd><a class="el" href="threadExample_8cpp-example.html#a6">threadExample.cpp</a>.</dd>
</dl>
</div>
</div>
<a class="anchor" id="ad0df3cd5e0d03c21975d0380585596d1"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void ArMutex::setLockWarningTime </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>lockWarningSeconds</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Sets the lock warning time (sec). </p>
<p>If it takes more than <em>lockWarningSeconds</em> to perform the mutex lock in <a class="el" href="classArMutex.html#a7b6aee74872c19fb8829d96dc3e52f34" title="Lock the mutex. ">lock()</a>, log a warning. </p><dl class="section note"><dt>Note</dt><dd>Available on Linux only </dd></dl>

</div>
</div>
<a class="anchor" id="a98c8e884ea991c9eead1359ac4c915bb"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">void ArMutex::setLog </td>
          <td>(</td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>log</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Sets a flag that will log out when we lock and unlock. </p>
<p>Use <a class="el" href="classArMutex.html#a00069ede1325b6f9f500ef2636858262" title="Sets a name we&#39;ll use to log with. ">setLogName()</a> to set a descriptive name for this mutex, and <a class="el" href="classArThread.html#af03075fb22fbfca1212d524f772f6c1c" title="Sets the name of the thread. ">ArThread::setThreadName()</a> to set a descriptive name for a thread. </p>

</div>
</div>
<a class="anchor" id="a7211feb3bf6a740a857ca6e338229f1b"></a>
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void ArMutex::setLogNameVar </td>
          <td>(</td>
          <td class="paramtype">const char *&#160;</td>
          <td class="paramname"><em>logName</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">&#160;</td>
          <td class="paramname"><em>...</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Sets a name we'll use to log with formatting. </p>
<p><b>Java and Python Wrappers:</b> Not available in Java or Python wrapper libraries. use <a class="el" href="classArMutex.html#a00069ede1325b6f9f500ef2636858262" title="Sets a name we&#39;ll use to log with. ">setLogName()</a> </p>

</div>
</div>
<a class="anchor" id="af9459634b10d103c933e058ce73f6874"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">static void ArMutex::setUnlockWarningTime </td>
          <td>(</td>
          <td class="paramtype">double&#160;</td>
          <td class="paramname"><em>unlockWarningSeconds</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">static</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Sets the unlock warning time (sec). </p>
<p>If it takes more than <em>unlockWarningSeconds</em> between the mutex being locked with <a class="el" href="classArMutex.html#a7b6aee74872c19fb8829d96dc3e52f34" title="Lock the mutex. ">lock()</a> then unlocked with <a class="el" href="classArMutex.html#afb51b5514a9456f23441e479fe58fb46" title="Unlock the mutex, allowing another thread to obtain the lock. ">unlock()</a>, log a warning. </p><dl class="section note"><dt>Note</dt><dd>Available on Linux only </dd></dl>

</div>
</div>
<a class="anchor" id="a76ff7a4aa451cc9c2b08dda0ae77d823"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">int ArMutex::tryLock </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Try to lock the mutex, but do not block. </p>
<p>Try to lock the mutex.</p>
<p>If this is a recursive mutex (the default type), and a <em>different</em> thread has locked this mutex, then return <a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a5a52964b5d55e36a0d170a49a8384961" title="Mutex already locked. ">ArMutex::STATUS_ALREADY_LOCKED</a>; if <em>this</em> thread has locked this mutex, then return 0.</p>
<p>If this is <em>not</em> a recursive mutex, then return 0 if any thread (including this thread) has locked this mutex.</p>
<p>Returns <a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62afef90eab73ec7c605c7d2093572db8ad" title="General failure. ">ArMutex::STATUS_FAILED</a> or <a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a410e62490f5c6ca8e320d60d1a25081b" title="Failed to initialize. ">ArMutex::STATUS_FAILED_INIT</a> on an error (such as threading not initialized or supported).</p>
<p>Call setLog(true) to enable extra logging.</p>
<dl class="section return"><dt>Returns</dt><dd>0 If <a class="el" href="classArMutex.html#a76ff7a4aa451cc9c2b08dda0ae77d823" title="Try to lock the mutex, but do not block. ">tryLock()</a> acquires the lock, or mutex is a recursive mutex (default) and is already locked by this thread </dd>
<dd>
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a5a52964b5d55e36a0d170a49a8384961" title="Mutex already locked. ">ArMutex::STATUS_ALREADY_LOCKED</a> if this mutex is currently locked by another thread, or if mutex is <em>not</em> recursive, by any thread including the current thread. </dd>
<dd>
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62afef90eab73ec7c605c7d2093572db8ad" title="General failure. ">ArMutex::STATUS_FAILED</a> on an error from the platform mutex implementation. </dd>
<dd>
<a class="el" href="classArMutex.html#a5b6ab50205f1004c939f3946cfca3c62a410e62490f5c6ca8e320d60d1a25081b" title="Failed to initialize. ">ArMutex::STATUS_FAILED_INIT</a> if the platform threading is not enabled, initialized, etc.</dd></dl>
<p>This function will not block if another thread has the mutex locked. It will return instantly if that is the case. It will return STATUS_ALREADY_LOCKED if another thread has the mutex locked. If it obtains the lock, it will return 0. </p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>ArMutex.h</li>
<li>ArMutex.cpp</li>
<li>ArMutex_LIN.cpp</li>
<li>ArMutex_WIN.cpp</li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="classArMutex.html">ArMutex</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
